import wx


class MyFrame(wx.Frame):

    def __init__(self, style):
        super().__init__(parent=None, id=-1, title="Frame sytle", pos=(400, 300), size=(800, 500), style=style)
        panel = wx.Panel(self)
        button = wx.Button(panel, label="Close", pos=(125, 10), size=(50, 50))

        self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow, button)

    def OnCloseMe(self, event):
        self.Close(True)

    def OnCloseWindow(self, event):
        self.Destroy()


class MyApp(wx.App):

    def OnInit(self):
        self.frame = MyFrame(wx.DEFAULT_FRAME_STYLE)
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True


if __name__ == '__main__':
    app = MyApp()
    app.MainLoop()
